package com.cy.pj.goods.dao.impl;

import com.cy.pj.goods.dao.GoodsDao;
import com.cy.pj.goods.pojo.Goods;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

//@Repository
public class GoodsDaoImpl implements GoodsDao {
    @Autowired
    private SqlSession sqlSession;
    @Override
    public List<Goods> findGoods() {
        //mybatis数据访问实现
        String namespace = this.getClass().getInterfaces()[0].getName();
//        String namespace="com.cy.pj.goods.dao.GoodsDao";
//        String statement = namespace+".findGoods";
        String elementId = Thread.currentThread().getStackTrace()[1].getMethodName();
       String statement=namespace+"."+elementId;
        List<Goods> list = sqlSession.selectList(statement);
        return list;
    }
}




